package com.example.jdbc.service;


import com.example.jdbc.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    public void getAllUser() {
        System.out.println("getAllUser方法");
        List<Map<String, Object>> list = userDao.getAllUser();
    }


    @Override
    public void addUser() {
        System.out.println("add方法");
        userDao.insetOneUser();

        // 发生异常时无法自动进行事务回滚
//        int y = 10/0;
    }


    @Override
    public void deleteUser() {
        System.out.println("delete方法");
    }

    @Override
    public void updateUser() {
        System.out.println("update方法");
    }

    @Override
    public void selectUser() {
        System.out.println("select方法");
    }

}
